# Author: Valley-e
# Date: 2024/12/16  
# Description:
import asyncio
import sys
from pptflow.utils import mylogger

# Setup logger
logger = mylogger.get_logger(__name__)

# 兼容不同操作系统的事件循环
if sys.platform == "win32":
    asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())

# tts setting
# tts_service_providers = ["azure", "edge-tts", "coqui-tts", "pyttsx3"]
tts_service_providers: dict = {"en": ["kokoro", "baidu", "azure"],
                               "zh": ["baidu", "azure"]}
tts_speech_regions = ["eastasia", "northeurope", "southeastasia", "westus"]
tts_speech_voices = ["en-US-EmmaNeural"]
# Video settings
video_formats = ['MP4', 'AVI', 'MOV']
video_codecs = ['H.264', 'H.265', 'VP9']
video_sizes = ["1280x720", "1920x1080", "2560x1440", "3840x2160", "720x480", "1280x960"]
video_fps = ["10fps", "30fps", "24fps"]
video_processing_threads = ["1", "2", "4", "8", "16"]
# Audio settings
# 发音人选择, 基础音库：0为度小美，1为度小宇，3为度逍遥，4为度丫丫，
# 精品音库：5为度小娇，103为度米朵，106为度博文，110为度小童，111为度小萌，默认为度小美
baidu_voice_persons: dict = {
    0: "度小美",
    1: "度小宇",
    3: "度逍遥",
    4: "度丫丫",
    5: "度小娇",
    103: "度米朵",
    106: "度博文",
    110: "度小童",
    111: "度小萌",
    4140: "度小新-专业女主播",
    4278: "度小贝-知识女主播",
    4129: "度小彦-知识男主播",
    4226: "南方-电台女主播",
    4277: "西贝-脱口秀女声",
    6602: "度清柔-温柔男神"
}
LANGUAGE_MAP = {
    'American English': 'a',
    'British English': 'b',
    'Japanese': 'j',
    'Mandarin Chinese': 'z',
    # 'Spanish': 'e',
    # 'French': 'f',
    # 'Hindi': 'h',
    # 'Italian': 'i',
    # 'Brazilian Portuguese': 'p'
}
GENDER_MAP = {
    'Female': 'f',
    'Male': 'm'
}
kokoro_voice_type = []
audio_formats = ['MP3', 'WAV', 'AAC']
audio_codecs = ['AAC', 'MP3', 'WAV']
audio_bitrates = ['128kbps', '256kbps', '320kbps']
audio_voice_type = ["zh-CN-YunjianNeural", "zh-CN-XiaoxiaoNeural"]
audio_speeds = ["1.0x", "0.8x", "1.2x", "1.5x"]
audio_languages = ['en', 'zh']
# Subtitle settings
subtitle_lengths = ["12", "16", "18", "24", "30", "80"]
subtitle_font_dict = {}
font_colors = ['white', 'black', 'red', 'blue', 'yellow', 'green']
border_colors = ['black', 'white', 'no_color']
border_widths = ["0", "1", "2", "3", "4"]
STYLE_MAP = {
        "presentation": "演讲风格（段落间有空行）",
        "video_script": "视频脚本风格（短句，口语化）",
        "storytelling": "故事叙述风格（感官描写）",
        "academic": "学术风格（数据引用）",
        "formal": "正式风格（专业术语）",
        "casual": "休闲风格（日常话术）",
        "poetic": "诗情画意风格（verse）",
        "humor": "幽默风格（ Sarcasm）",
    }
# Language Settings
language_mode = ['en', 'zh']
